﻿<UserControl x:Class="Clarity.Wpf.GetAnswerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:c="clr-namespace:Clarity.Wpf"
             x:Name="answerView"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <TextBlock Text="{Binding Path=Message}" TextWrapping="Wrap" />

        <ItemsControl ItemsSource="{Binding Path=Answers}" Grid.Row="1" HorizontalAlignment="Right" Margin="10" Focusable="False">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" IsItemsHost="True" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Content="{Binding Path=Text}" IsCancel="{Binding Path=IsCancel}" IsDefault="{Binding Path=IsDefault}" Command="{c:CBinding ElementName=answerView, Path=DataContext.ChooseAnswer}" CommandParameter="{Binding}" MinWidth="60" Margin="5,0"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>
